﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ProtoGame
{
    class PGBackgroundScreen : DrawableGameComponent
    {
        SpriteBatch spriteBatch;
        Texture2D image;
        String imagePath;

        public PGBackgroundScreen(String imagePath, Game game)
            : base(game)
        {
            this.imagePath = imagePath;
        }

        public override void Initialize()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            base.Initialize();
        }

        protected override void LoadContent()
        {
            image = Game.Content.Load<Texture2D>(imagePath);

            base.LoadContent();
        }

        public override void Draw(GameTime gameTime)
        {
            spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Texture, SaveStateMode.SaveState);
            spriteBatch.Draw(image, Vector2.Zero, Color.White);
            spriteBatch.End();

            base.Draw(gameTime);
        }
    }
}
